<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>分场查询</title>
    <link rel="stylesheet" href="/static/css/style.css">
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>

<body>
    <nav class="navbar">
        <div class="container navbar-container"
            style="margin: 0; max-width: none; display: flex; justify-content: space-between;">
            <a class="navbar-brand" href="/">
                <img src="/static/128431.ico" alt="Logo" style="height: 30px;">
                PCR 渠道服工具箱
            </a>
            <div class="navbar-menu">
                <a class="navbar-item" href="/">
                    当期会战
                </a>
                <a class="navbar-item" href="/">
                    历史会战
                </a>
                <a class="navbar-item active" href="/arena">
                    分场查询
                </a>
            </div>
        </div>
    </nav>

    <div class="container fade-in">
        <div class="card">
            <div class="card-header">
                分场查询
            </div>
            <div class="form-group">
                <label>请输入游戏内13位ID</label>
                <input type="number" id="id" class="form-control" placeholder="查询ID">
            </div>
            <button class="btn" id="b01">查询</button>
        </div>

        <div class="card" id="resultCard" style="display: none;">
            <div id="myDiv"></div>
        </div>
    </div>

    <script>
        $(function () {
            $("#b01").click(function () {
                var btn = $(this);
                btn.prop('disabled', true).text('查询中...');
                $.ajax({
                    url: "arena_search",
                    type: "POST",
                    dataType: "text",
                    data: {
                        id: $("#id").val()
                    },
                    success: function (data) {
                        $("#resultCard").show();
                        $("#myDiv").html(data);
                        btn.prop('disabled', false).text('查询');
                    },
                    error: function () {
                        $("#resultCard").show();
                        $("#myDiv").html("查询失败，请稍后重试");
                        btn.prop('disabled', false).text('查询');
                    }
                })
            });
        })
    </script>
</body>

</html>